#include <reg52.h>
#include "carbasic.h"
#include "delay.h"
#include "infrared_avoid.h"
extern unsigned int flg;


void infrared_avoid(){

if((AVOID_L==1)&&(AVOID_R==1)){
  Forward();
}
if((AVOID_L==0)&&(AVOID_R==0)){
if(flg!=0)
 fm();
 Back();
 delay(800);
 Circle_Left();
 delay(700);
 Forward();
}
if((AVOID_L==0)&&(AVOID_R==1)){
 Back();
 delay(800);
 Right();
 delay(700);
}
if((AVOID_L==1)&&(AVOID_R==0)){
 Back();
 delay(800);
 Left();
 delay(700);
}



}
